#ifndef ROSyncObject_H
#define ROSyncObject_H

#include <QObject>
#include <QtQmlIntegration>

//用于客户端和服务端之间沟通交流的对象

class ROHostPrivate;
class RONodePrivate;
class ROSyncCreation;

class ROSyncObject:public QObject
{
    Q_OBJECT
    QML_NAMED_ELEMENT(ROSyncObject)
public:
    ROSyncObject(QObject* parent = nullptr);
    enum Role//角色信息
    {
        None,//无意义
        Host,//这是服务端
        Client,//这是客户端
        Individual//这是独立创建的
    };
    Q_ENUM(Role);

    Role role() const;
    void setRole(const Role &newRole);

protected:
    virtual void initialize();

signals:
    void roleChanged();

private:
    Role m_role = None;

    Q_PROPERTY(Role role READ role WRITE setRole NOTIFY roleChanged FINAL)
    friend class ROHostPrivate;
    friend class RONodePrivate;
    friend class ROSyncCreation;
};

#endif
